package wonder;

import java.io.Serializable;

import wonder.IResource.ResourceType;

public class BoardInitialResource implements IBoardInitialResource, Serializable {
    private static final long serialVersionUID = -8053685594535468703L;
    private ResourceType resource;
    private int quantity;
    private UsageType usageType;

    public BoardInitialResource() {
        super();
    }

    public BoardInitialResource(ResourceType resource, int quantity, UsageType usageType) {
        super();
        this.resource = resource;
        this.quantity = quantity;
        this.usageType = usageType;
    }

    public BoardInitialResource(String resource, int quantity, String usageType) {
        super();
        this.resource = ResourceType.valueOf(resource);
        this.quantity = quantity;
        this.usageType = UsageType.valueOf(usageType);
    }

    /** {@inheritDoc} */
    @Override
    public String toString() {
        StringBuffer sb = new StringBuffer("{ ");
        sb.append(resource);
        sb.append(":");
        sb.append(quantity);
        sb.append(", ");
        sb.append(usageType);
        sb.append(" }");
        return sb.toString();
    }

    @Override
    public ResourceType getResourceType() {
        return resource;
    }

    @Override
    public void setResourceType(String resource) {
        this.resource = ResourceType.valueOf(resource);
    }

    @Override
    public int getQuantity() {
        return quantity;
    }

    @Override
    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }

    @Override
    public UsageType getUsageType() {
        return usageType;
    }

    @Override
    public void setUsageType(String usageType) {
        this.usageType = UsageType.valueOf(usageType);
    }
}
